#include <iostream>
#include <string>
#include <variant>
using namespace std;
int main() {
  variant<float, int> a, b;
  a = 12;
  b = 13.f;
  cout << get<int>(a) << " ";
  cout << get<0>(b) << "\n";
  a = b;
  cout << get<float>(a);
  variant<string> c("hello"); //无歧义转换
  string d = "world";
  c = d;
  cout << get<string>(c) << endl;
  variant<string, void const *> y("hello");
  cout << boolalpha << holds_alternative<void const *>(y) << "\n"; // true
  y = "xyz";
  cout << holds_alternative<string>(y) << "\n"; // true
}
